import Http from '../http';

// 用例上传
export const uploadExcel = function(data: any) {
    return Http.post('/fastApi/case/uploadExcelCase/', data,
        { headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
                 timeout: 600000   // 设置文件上传的超时时间 单位是： ms
        })
}

export const queryProjects = function(data: any) {
    return Http.get('/fastApi/case/queryProjects/', data)
}

export const queryProgressApi = function(data: any) {
    return Http.get('/fastApi/case/queryUploadProgress/', data)
}

export const queryConfigApi = function(data: any) {
    return Http.get('/fastApi/case/queryConfig/', data)
}

export const saveConfigApi = function(data: any) {
    return Http.post('/fastApi/case/saveConfig/', data,
        { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }})
}

export const queryRecord = function(data: any) {
    return Http.get('/fastApi/case/queryRecord/', data)
}

export const deleteFilename = function(data: any) {
    return Http.get('/fastApi/case/deleteFilename/', data)
}

export const downExcelFile = function(data: any) {
    return Http.get('/fastApi/' + data.url, {}, {responseType: 'blob'})
}

export const queryTablesApi = function(data: any) {
    return Http.get('/fastApi/case/queryTables/', data)
}

export const queryDownloadProgressApi = function(data: any) {
    return Http.get('/fastApi/case/queryDownloadProgress/', data)
}

export const downloadTablesApi = function(data: any) {
    return Http.post('/fastApi/case/downloadTables/', data,
        { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }})
}

export const queryCompanyNos = function(data: any) {
    return Http.get('/fastApi/env/queryCompanyNo', data)
}

export const saveCompanyNo = function(data: any) {
    return Http.post('/fastApi/env/saveCompanyNo', data,
        { headers: { 'Content-Type': 'application/json' }})
}

export const deleteCompanyNo = function(data: any) {
    return Http.delete('/fastApi/env/deleteCompanyNo', data)
}

// 环境检查&切换公司号
export const queryDatabasesApi = function(data: any) {
    return Http.get('/fastApi/env/getDataBases/', data)
}

export const checkAndClearZipApi = function(data: any) {
    return Http.post('/fastApi/env/checkMachineUsed', data)
}

export const queryZipReportApi = function(data: any) {
    return Http.get('/fastApi/env/queryZipReport', data)
}

export const runCmdsApi = function(data: any) {
    return Http.post('/fastApi/env/runCmds', data)
}

export const saveCmdApi = function(data: any) {
    return Http.post('/fastApi/env/saveCmd', data)
}

export const queryCmdRecordApi = function(data: any) {
    return Http.get('/fastApi/env/queryCmdRecord', data)
}

export const deleteCmdRecordApi = function(data: any) {
    return Http.delete('/fastApi/env/deleteCmdRecord', data)
}

export const compareZipApi = function(data: any) {
    return Http.post('/fastApi/env/compareZip/', data,
        { headers: {
                'Content-Type': 'application/x-www-form-urlencoded',
                timeout: 10*60*1000
            }
        })
}

export const changeNoApi = function(data: any) {
    return Http.post('/fastApi/env/changeNo/', data,
        { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
        })
}

export const changeLogApi = function(data: any) {
    return Http.post('/fastApi/env/checkLog/', data,
        { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
        })
}

export const mockDataApi = function(data: any) {
    return Http.post('/fastApi/env/mockData/', data,
        { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
        })
}


export const checkEnvironmentApi = function(data: any) {
    return Http.get('/fastApi/env/checkEnvironment/', data)
}

export const queryEnvLogApi = function(data: any) {
    return Http.get('/fastApi/env/queryEnvLog/', data)
}

export const uploadAndImportSqlApi = function(data: any) {
    return Http.post('/fastApi/env/importSql/', data,
        { headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
                 timeout: 600000   // 设置文件上传的超时时间 单位是： ms
        })
}